#pragma once

#include <QCalendarWidget>

#include "widgets.h"

class S_WIDGETS_EXPORT SCalendar : public QCalendarWidget {
  Q_OBJECT
 public:
  SCalendar(QWidget* parent = nullptr, bool showBorder = false,
            QString label = "", int labelHeight = 50);
  ~SCalendar();

  void active();
  void setStart(const QDate& start);
  void setEnd(const QDate& end);
  void setSelectedColorBetweenTwoDatas(QDate start, QDate end);

 protected:
  void paintEvent(QPaintEvent* event) override;
  void paintCell(QPainter* painter, const QRect& rect,
                 const QDate& date) const override;
  bool eventFilter(QObject* obj, QEvent* event);

 private:
  QDate _start;
  QDate _end;
  QDate _colorStart;
  QDate _colorEnd;
  bool m_showBorder = false;
};
